Conversation
|
|
||
| #include <vector> | ||
|
|
||
| std::vector<int> FindNumberOfSumma(std::vector<int> vec, int summa); No newline at end of file |
There was a problem hiding this comment.
warning: function 'FindNumberOfSumma' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
| std::vector<int> FindNumberOfSumma(std::vector<int> vec, int summa); | |
| static std::vector<int> FindNumberOfSumma(std::vector<int> vec, int summa); |
| throw std::runtime_error("Vector is empty"); | ||
| } | ||
| int start_iterator{0}; | ||
| int end_iterator{vec.size() - 1}; |
There was a problem hiding this comment.
warning: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'int' in initializer list [clang-diagnostic-c++11-narrowing]
int end_iterator{vec.size() - 1};
^Additional context
task_01/src/task1.hpp:8: insert an explicit cast to silence this issue
int end_iterator{vec.size() - 1};
^| std::vector<int> days_to_warming; | ||
| std::stack<std::pair<int, int>> decreasing_stack; | ||
|
|
||
| int last_index{temperature_list.size() - 1}; |
There was a problem hiding this comment.
warning: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'int' in initializer list [clang-diagnostic-c++11-narrowing]
int last_index{temperature_list.size() - 1};
^Additional context
task_03/src/topology_sort.cpp:15: insert an explicit cast to silence this issue
int last_index{temperature_list.size() - 1};
^| #include <queue> | ||
| #include <utility> | ||
|
|
||
| std::vector<int> BuyFish(std::vector<int> price_list, int period) { |
There was a problem hiding this comment.
warning: function 'BuyFish' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
std::vector<int> BuyFish(std::vector<int> price_list, int period) {
^Additional context
task_04/src/task4.hpp:7: make as 'inline'
std::vector<int> BuyFish(std::vector<int> price_list, int period) {
^| right_arr.push_back(vec[i]); | ||
| } | ||
| } | ||
| int pivot_index{left_arr.size()}; |
There was a problem hiding this comment.
warning: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'int' in initializer list [clang-diagnostic-c++11-narrowing]
int pivot_index{left_arr.size()};
^Additional context
task_06/src/task6.hpp:17: insert an explicit cast to silence this issue
int pivot_index{left_arr.size()};
^| q.push(root); | ||
| int level{0}; | ||
| while (!q.empty()) { | ||
| Node<K, V> *current = q.front(); |
There was a problem hiding this comment.
warning: parameter 'x' is unused [misc-unused-parameters]
| Node<K, V> *current = q.front(); | |
| > * /*x*/) { |
| #include <iostream> | ||
| #include <vector> | ||
|
|
||
| std::vector<int> PreprocessMaxReach(std::vector<std::vector<int>>& a) { |
There was a problem hiding this comment.
warning: function 'PreprocessMaxReach' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
std::vector<int> PreprocessMaxReach(std::vector<std::vector<int>>& a) {
^Additional context
task_09/src/task9.hpp:7: make as 'inline'
std::vector<int> PreprocessMaxReach(std::vector<std::vector<int>>& a) {
^| return max_reach_for_row; | ||
| } | ||
|
|
||
| bool CheckRangeSorted(const std::vector<int>& max_reach_for_row, int l, int r) { |
There was a problem hiding this comment.
warning: function 'CheckRangeSorted' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
bool CheckRangeSorted(const std::vector<int>& max_reach_for_row, int l, int r) {
^Additional context
task_09/src/task9.hpp:42: make as 'inline'
bool CheckRangeSorted(const std::vector<int>& max_reach_for_row, int l, int r) {
^There was a problem hiding this comment.
лучше назвать файлы более понятно
There was a problem hiding this comment.
и кажется тут перепутаны cpp и hpp
There was a problem hiding this comment.
У меня каждый раз падает сборка. Никак решить не могу проблему. я буду реалезацию в hpp писать, а cpp пустым оставлять
| @@ -0,0 +1,5 @@ | |||
| #pragma ones | |||
| } | ||
| int start_iterator{0}; | ||
| int end_iterator{vec.size() - 1}; | ||
| std::vector<int> return_vector; |
There was a problem hiding this comment.
лучше и короче будет не return_vector а result
| #include <vector> | ||
| #include <stdexcept> | ||
|
|
||
| std::vector<int> FindNumberOfSumma(std::vector<int> vec, int summa) { |
There was a problem hiding this comment.
summa транслит в коде плохая практика
| @@ -1,23 +1,72 @@ | |||
| #pragma once | |||
| #ifndef STACK_H | |||
| #define STACK_H | |||
There was a problem hiding this comment.
в прошлой задаче использовал #pragma once (хотя и не совсем правильно:)) тут через ifndef, выбери один вариант и используй его везде. я за #pragma, но ты можешь выбрать что тебе удобнее
| private: | ||
| std::stack<int> data_; | ||
| void Pop() { | ||
| if (IsEmpty()) { |
There was a problem hiding this comment.
класс не шаблонный, лучше перенести реализацию в cpp файл
и в других местах тоже
| return minStack.back(); | ||
| } | ||
|
|
||
| bool isEmpty() { return stack.empty(); } |
There was a problem hiding this comment.
переименуй файлы на что то более подходящее
| temperature_list[i] >= decreasing_stack.top().first) { | ||
| decreasing_stack.pop(); | ||
| } | ||
| if (decreasing_stack.size() == 0) { |
There was a problem hiding this comment.
лучше decreasing_stack.empty()
There was a problem hiding this comment.
так же перепутаны cpp и hpp
| } | ||
|
|
||
| template <typename T> | ||
| std::vector<T> Heap_sort(std::vector<T> list) { |
| throw std::runtime_error("Vector is empty"); | ||
| } | ||
| int start_iterator{0}; | ||
| int end_iterator{vec.size() - 1}; |
There was a problem hiding this comment.
warning: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'int' in initializer list [clang-diagnostic-c++11-narrowing]
int end_iterator{vec.size() - 1};
^Additional context
task_01/src/find_numbers.cpp:7: insert an explicit cast to silence this issue
int end_iterator{vec.size() - 1};
^| std::vector<int> days_to_warming; | ||
| std::stack<std::pair<int, int>> decreasing_stack; | ||
|
|
||
| int last_index{temperature_list.size() - 1}; |
There was a problem hiding this comment.
warning: non-constant-expression cannot be narrowed from type 'size_type' (aka 'unsigned long') to 'int' in initializer list [clang-diagnostic-c++11-narrowing]
int last_index{temperature_list.size() - 1};
^Additional context
task_03/src/find_days_to_warm.cpp:15: insert an explicit cast to silence this issue
int last_index{temperature_list.size() - 1};
^|
|
||
| template <typename K, typename V> | ||
| Node<K, V> *SplayTree<K, V>::maximum() { | ||
| Node<K, V> *max = root; |
There was a problem hiding this comment.
тут тоже бы проверить на nullptr
| } | ||
|
|
||
| template <typename K, typename V> | ||
| std::vector<K> SplayTree<K, V>::tree_vector(Node<K, V> *x) { |
There was a problem hiding this comment.
x не используется в методе, ошибка?
| */ | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { |
| void Print() const; | ||
|
|
||
| private: | ||
| std::vector<std::vector<Node<K, V>>> hash_vector; |
There was a problem hiding this comment.
лучше использовать std::vector<std::list<..>> удаление будет проще
| if (Contains(key)) { | ||
| std::vector<Node<K, V>> buf_vector; | ||
| for (auto node : hash_vector[index]) { | ||
| if (node.key != key) { |
There was a problem hiding this comment.
number_of_elemnts в этом методе не уменьшается
| private: | ||
| std::vector<std::vector<Node<K, V>>> hash_vector; | ||
| void ReHashVector(); | ||
| int number_of_elemnts{0}; |
There was a problem hiding this comment.
number_of_elements опечатка
There was a problem hiding this comment.
хорошо бы все файлы нормально называть)
No description provided.